package com.qf.shopping.service.carService.impl;

import com.qf.shopping.mapper.carMapper.CarMakeMapper;
import com.qf.shopping.pojo.car.CarMake;
import com.qf.shopping.service.carService.ICarMakeService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author Humy
 * @date 2019/4/18 21:03
 */

@Service
@Transactional
public class CarMakeServiceImpl implements ICarMakeService {

    @Resource
    private CarMakeMapper carMakeMapper = null;

    @Override
    public void add(CarMake carMake) {

        carMakeMapper.insert(carMake);

    }

    @Override
    public List<CarMake> query(CarMake carMake) {

        List<CarMake> carMakes = carMakeMapper.findCarMakeByVo(carMake);
        return carMakes;

    }

    /**
     * 查询所有品牌
     * @return
     */
    @Override
    public List<CarMake> queryAll() {

        List<CarMake> carMakes = carMakeMapper.findAllCarMake();
        return carMakes;
    }

    /**
     * 根据id查询
     * @param id
     * @return
     */
    @Override
    public CarMake queryById(Long id) {

        CarMake carMake = carMakeMapper.findCarMakeById(id);

        return carMake;
    }

    @Override
    public void update(CarMake carMake) {

        carMakeMapper.updateCarMake(carMake);

    }

    @Override
    public void delete(Long... ids) {

        carMakeMapper.deleteCarMake(ids);

    }


}
